<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>帖子详情页面</title>
		<link rel="stylesheet" type="text/css" href="{$webSite}public/css/base.css">
		<!-- 以下均是编译器所需的文件 -->
		<link href="{$webSite}public/answer_editor/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
		<script type="text/javascript" src="{$webSite}public/answer_editor/third-party/jquery.min.js"></script>
		<script type="text/javascript" src="{$webSite}public/answer_editor/third-party/template.min.js"></script>
		<script type="text/javascript" charset="utf-8" src="{$webSite}public/answer_editor/umeditor.config.js"></script>
		<script type="text/javascript" charset="utf-8" src="{$webSite}public/answer_editor/umeditor.min.js"></script>
		<script type="text/javascript" src="{$webSite}public/answer_editor/lang/zh-cn/zh-cn.js"></script>
	    

	</head>
	
	<style>
		.detail{
			width:960px;
			min-height:400px;
			//background:pink;
			margin:0 auto;
		}
		/********	顶部向导条guide		*************/
		.guide{
			width:960px;
			height:30px;
			margin:0 auto;
		}
		.guide img{
	
			float:left;
		}
		.guide div{
			min-width:40px;
			max-width:120px;
			margin-left:5px;
			margin-top:3px;
			float:left;
			white-space:nowrap;
			text-overflow:ellipsis;
			overflow:hidden; 
		}
		/****	发帖,回帖 , 返回,按钮  detail_btn*****/
		.detail_btn{
			width:960px;
			height:50px;
			margin:0 auto;
			margin-top:10px;
		}
		.detail_btn_post , .detail_btn_reply{
			width:70px;
			height:35px;
			background:#7B68EE;
			color:#fff;
			font-size:14px;
			font-weight:bold;
			float:left;
			margin-top:5px;
			margin-left:10px;
		}
		
		.detail_btn_back{
			width:80px;
			height:30px;
			background:#fff;
			border:#C2D5E3 1px solid;
			float:right;
			margin-top:5px;
			margin-right:10px;
		}
		/**********	评论内容顶部 detail_content_top 区域	************/
		.detail_content_top{
			width:960px;
			height:30px;
			border-top:1px #ccc solid;
		}
		.detail_content_top_font_0 a{
			width:60px;
			color:#336699;
			float:left;
			text-align:center;
			margin-top:8px;
			margin-left:10px;
		}
		.detail_content_top_font a{
			width:40px;
			color:#336699;
			float:left;
			text-align:center;
			margin-left:5px;
			margin-top:8px;
		}
		.detail_content_top_border{
			width:1px;
			height:12px;
			background:#ccc;
			float:left;
			margin-left:5px;
			margin-top:10px;
		}
		/**********	评论内容 detail_content 区域	************/
		.detail_content{
			width:960px;
			min-height:350px;
			border:1px #ccc solid;
		}
		/**********	评论内容 detail_content_left 左侧用户信息    *********/
		.detail_content_left{
			width:160px;
			min-height:300px;
			border-right:1px solid #ccc;
			border-bottom:1px solid #ccc;
			float:left;

		}
		.detail_content_left ul{
			width:160px;
			height:50px;
			
		}
		.detail_content_left_read{
			width:60px;
			height:40px;
			text-align:center;
			line-height:40px;
			float:left;
			margin-left:10px;
		}
		.detail_content_left_border{
			width:1px;
			height:12px;
			background:#ccc;
			margin-top:15px;
			margin-left:5px;
			float:left;
		}
		.detail_content_left_reply{
			width:60px;
			height:40px;
			text-align:center;
			line-height:40px;
			margin-left:5px;
			float:left;
		}
		.detail_content_left ul li span{
			color:red;
			font-weight:bold;
		}

		.detail_content_left_user{
			width:160px;
			height:45px;
			border-bottom:1px #ccc dashed;
			
		}
		.detail_content_left_user div{
			width:100px;
			height:45px;
			text-align:center;
			line-height:45px;
			margin-left:20px;
			font-weight:bold;
		}
		.detail_content_left_pic{
			width:160px;
			height:120px;
			margin-top:10px;	
			
		}
		.detail_content_left_pic img{
			display:block;
			width:120px;
			height:120px;
			margin:0 auto;

		}
		
		.detail_content_left_type{
			width:160px;
			height:30px;
			color:red;
			line-height:30px;
			
		}
		.detail_content_left_level{
			width:160px;
			height:30px;
			line-height:30px;
			
		}
		.detail_content_left_grade{
			width:160px;
			height:30px;
			line-height:30px;
			
		}

		.detail_content_left_level span ,.detail_content_left_grade span {
			font-weight:bold;
			color:red;
		}

		.detail_content_left_level_pic img{
			display:block;
			width:130px;
			height:50px;
			margin:0 auto;
			margin-bottom:10px;
			
		}
		/**********	评论 detail_content_right  右侧帖子详情    *********/
		.detail_content_right{
			width:758px;
			min-height:350px;
			margin-left:20px;
			float:left;
		}
		.detail_content_right_top1{
			width:758px;
			height:50px;
			
		}
		.detail_content_right_top1_left{
			min-width:100px;
			height:50px;
			line-height:50px;
			float:left;
			font-size:16px;
			font-weight:bold;
		}
		.detail_content_right_top1_right{
			width:50px;
			height:50px;
			line-height:50px;
			text-align:center;
			margin-left:20px;
			float:right;
		}


		.detail_content_right_top2{
			width:758px;
			height:50px;
			border-bottom:1px dashed #ccc;
		}
		
		.detail_content_right_top2_left{
			width:200px;
			height:50px;
			line-height:50px;
			float:left;
			
		}
		.detail_content_right_top2_left img{
			margin-left:5px;
		}
		.detail_content_right_top2_right{
			width:200px;
			height:50px;
			line-height:50px;
			text-align:center;
			margin-left:20px;
			float:right;
		}
		
		.detail_content_right_top2_right a , .detail_content_right_top2_right  div{
			float:left;
			margin-left:30px;
		}

		.detail_content_right_top2_right  div input{
			width:40px;

		}
		.detail_content_right_main{
			width:758px;
			min-height:200px;
		}
		.detail_content_right_locked{
			width:754px;
			height:40px;
			margin:0 auto;
			margin-top:10px;
			line-height:40px;
			border:1px red dashed;
			
		}
		.detail_content_right_locked img{
			margin-left:5px;

		}
		.detail_content_right_locked:hover{
			background:#F7F7F7;
		}
		.detail_content_right_locked  a{
			margin-left:450px;
			color:red;
			font-size:14px;	
		}
		.detail_content_right_locked  span{
			
			color:red;
			font-size:14px;
			font-weight:bold;	
		}

		.detail_content_right_content{
			
			width:758px;
			min-height:150px;
			margin:0 auto;
			margin-top:8px;
			line-height:100px;
			text-indent:2rem;
		}
	
		.detail_content_right_bottom{
			width:758px;
			height:35px;
			border-top:1px dashed #ccc;
			
		}
		.detail_content_right_bottom ul .li_left{
			float:left;
			margin-top:10px;
			margin-left:5px;
		
		}
		
		.detail_content_right_bottom ul .li_right{
			float:right;
			margin-top:10px;
			margin-right:10px;
		}
		.detail_content_right_bottom ul .li_border{
			width:1px;
			height:12px;
			background:#ccc;
			float:right;
			margin-top:12px;
			margin-right:10px;
		}
		/**********	 评论展示 detail_show_reply 区域 	************/
		.detail_show_reply{

			width:960px;
			min-height:300px;
			border:1px #ccc solid;
			margin-top:10px;
		}
		

		/****	底部分页栏 detail_page	*****/
		.detail_page{
			width:960px;
			height:50px;
			margin:0 auto;
		}
		
		.detail_page_ul li{
			float:right;
			line-height:50px;
			margin-right:15px;
		}
		.detail_page_ul li input{
			width:30px;
			height:25px;
			float:left;
			margin-top:12px;
		}
		.detail_page_ul li span{
			
			font-weight:bold;
		}

		/********	回帖 detail_reply 区域 		*****/
		.detail_reply{
			width:960px;
			min-height:350px;
			margin: 0 auto;
			margin-top:20px;
			margin-bottom:50px;
			border:1px #ccc solid;
		}
		.detail_answer_right_text{
			width:740px;
			margin-top:20px;
			margin-left:5px;
		}
		
		
		.detail_answer_right_button input{
			width: 80px;
			height:35px;
			margin-left:5px;
			margin-top:5px;
			margin-bottom:10px;
			font-size:16px;
			color: #fff;
			background: #7B68EE;
			cursor: pointer;

		}
	</style>

	<body>

		<div class="detail">
			
				
			<!-- 向导条部分 -->
			<div class="guide clearFix">
				<img src="{$webSite}public/images/guide.png">
				<div><a href="">论坛 > </a></div>
				<div><a href="">{$parentName} > </a></div>
				<div><a href="">{$sonName} > </a></div>
				<div><a href="">{$currTitle}</a></div>
			</div>
		
			<!-- 按钮上 detail_btn 区域 -->
			<div class="detail_btn clearFix">
				<a href="{$webSite}post.php?cid={$currCid}">
					<button class="detail_btn_post">发 帖</button>
				</a>
				<a href="#reply">
					<button class="detail_btn_reply">回 复</button>
				</a>
				<a href="{$webSite}public.php?cid={$currCid}">
					<button class="detail_btn_back">返 回 列 表</button>
				</a>
			</div>

			<!-- 评论内容顶部 detail_content_top 区域 -->
			{if $userType == 1}
			<div class="detail_content_top">
				 <ul class="detail_content_top_ul clearFix">
					<li class="detail_content_top_font_0">
						<a href="{$webSite}admin/home/post_isdel.php?id={$getId}&isdel=1">删除主题</a>
					</li>
					<li class="detail_content_top_border"></li>
					<li class="detail_content_top_font">
						<a href="{$webSite}admin/home/post_istop.php?id={$getId}&istop=1">置顶</a>
					</li>
					<li class="detail_content_top_border"></li>
					<li class="detail_content_top_font">
						<a href="{$webSite}admin/home/post_ishot.php?id={$getId}&ishot=1">高亮</a>
					</li>
					<li class="detail_content_top_border"></li>
					<li class="detail_content_top_font">
						<a href="{$webSite}admin/home/post_elite.php?id={$getId}&elite=1">精华</a>
					</li>
					<li class="detail_content_top_border"></li>
					
				</ul> 
			</div>
			{/if}

			<!-- 评论内容 detail_content 区域 -->
			<div class="detail_content clearFix">
				
				<!-- 遍历的当前帖子的所有信息 -->
				{if $resDetail}
				{foreach $resDetail as $valDetail}
				
				<div class="detail_content_left">
					<!-- 来访数据  -->
					<ul class="clearFix">
						<li class="detail_content_left_read">查看:&nbsp;<span>{$valDetail['hits']}</span></li>
						<li class="detail_content_left_border"></li>
						<li class="detail_content_left_reply">回复: &nbsp;<span>{$valDetail['replycount']}</span></li>
						
					</ul>

					<!-- 此处利用 uid 等于 authorid (用户id) -->
					{foreach $resAuthor as $valAuthor}
						{if $valAuthor['uid'] == $valDetail['authorid']}
					<!-- 用户名 -->
					<div class="detail_content_left_user">
						<div>{$valAuthor['username']}</div>
					</div>

					<!-- 头像  -->
					<div class="detail_content_left_pic">
						<img src="{$webSite}{$valAuthor['picture']}">
					</div>

					<!-- 用户身份(权限)  -->
					<div class="detail_content_left_type">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$type1=$valAuthor['usertype']==1 ? '管理员' : '普通用户' ;}</div>
					
					<!--  用户等级信息 -->
					<div class="detail_content_left_level">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;等级 : <span>{$valAuthor['levname']}</span></div>
					
					<!-- 此处利用 levname 等于 levname (用户等级) -->
					{foreach $resLevel as $valLevel}
						{if $valLevel['levname'] == $valAuthor['levname']}
					<!-- 距离下一等级的积分 -->
					<div class="detail_content_left_grade">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;距离下一级还差 <span>{$mon=$valLevel['grade'] + 201 - $valAuthor['grade'];}</span> 积分</div>

					<!-- 等级头像 -->
					<div class="detail_content_left_level_pic">

						<img src="{$webSite}{$valLevel['levpicture']}">
					</div>
						{/if}
					{/foreach}

						{/if}		
					{/foreach}

				</div>
				
				<!-- 帖子详情 -->
				<div class="detail_content_right">

					<div class="detail_content_right_top1 clearFix">
						
						<div class="detail_content_right_top1_left">{$valDetail['title']}</div>
						<div class="detail_content_right_top1_right">

							<a href="">
								<img src="{$webSite}public/images/prev.png">
							</a>

							<a href="">
								<img src="{$webSite}public/images/next.png">
							</a>
						</div>
					</div>
				
					<div class="detail_content_right_top2 clearFix">
						<div class="detail_content_right_top2_left"><img src="{$webSite}public/images/time.gif">&nbsp;&nbsp;发表于 {$time1=date('Y-m-d H:i:s' , $valDetail['addtime']);}</div>
						<div class="detail_content_right_top2_right">
							<a href="">楼主</a>

							<div class="">
								电梯直达<input type="text"><img src="{$webSite}public/images/floor.png">

							</div>
						</div>
					</div>
					
					<!-- 真正的内容 detail_content_right_main -->
					<div class="detail_content_right_main">
						
						<!-- 判断帖子是否收费 -->
						{if $valDetail['rate'] != 0}
						<!-- 判断是否为主人 或 是否已经购买 -->
							{if !($valDetail['authorid'] == $uid  ||  $resOrder)}
								
						<div class="detail_content_right_locked">
							<img src="{$webSite}public/images/locked.gif"/>&nbsp;&nbsp;付费主题，价格：&nbsp;<span>{$valDetail['rate']}&nbsp;</span>金钱

								<a href="{$webSite}admin/home/payfor.php?id={$getId}">
									<img src="{$webSite}public/images/money.gif">&nbsp;点击购买
								</a>
						
						</div>

							{else}
						<div class="detail_content_right_content">{$valDetail['content']}</div>
							{/if}
						{else}
						<div class="detail_content_right_content">{$valDetail['content']}</div>
						{/if}
					</div>
				
					<!-- 底部功能 detail_content_right_bottom -->
					<div class="detail_content_right_bottom">
						<ul class="clearFix">
							
							<img class="li_left" src="{$webSite}public/images/reply.gif"/>
							
							<li class="li_left">
								
								<a href="#reply">回复</a>
							</li>
							
							{if $userType == 1}
							<li class="li_right">
								<a href="{$webSite}admin/home/post_elite.php?id={$getId}&elite=1">精华</a>
							</li>
							<li class="li_border"></li>
				
							<li class="li_right">
								<a href="{$webSite}admin/home/post_istop.php?id={$getId}&istop=1">置顶</a>
							</li>
							
							<li class="li_border"></li>
							<li class="li_right">
								<a href="{$webSite}admin/home/post_isdel.php?id={$getId}&isdel=1">删除</a>
							</li>
							{/if}
							
							
						</ul>
					</div>
				</div>

			</div>
			{/foreach}
			{/if}
			

		<!-- 判断帖子是否收费 判断是否为主人 或 是否已经购买 -->
		{if  $valDetail['rate'] == 0 || ($valDetail['authorid'] == $uid  ||  $resOrder)}
			<!-- 遍历出当前帖子的所有回复 -->
			{if $resReply}
			<!-- 起始点 -->
			{for $i=0; $i <= $count; $i++}
				{foreach $resAuthor as $valAuthor2}
				{if $valAuthor2['uid'] == $resReply[$i]['authorid']}
								
			<!-- 评论展示 detail_show_reply 区域 -->
			<div class="detail_show_reply clearFix">
				<div class="detail_content_left">
					
					<!-- 用户名 -->
					<div class="detail_content_left_user">
						<div>{$valAuthor2['username']}</div>
					</div>

					<!-- 头像  -->
					<div class="detail_content_left_pic">
						<img src="{$webSite}{$valAuthor2['picture']}">
					</div>

					<!-- 用户身份(权限)  -->
					<div class="detail_content_left_type">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$type2=$valAuthor2['usertype']==1 ? '管理员' : '普通用户' ;}</div>

					<!-- 利用用户等级 levname 相等 -->
					{foreach $resLevel as $valLevel2}
						{if $valLevel2['levname'] == $valAuthor2['levname']}
					<!--  用户等级信息 -->
					<div class="detail_content_left_level">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;等级 : <span>{$valAuthor2['levname']}</span></div>

					<!-- 距离下一级差多少积分 -->
					<div class="detail_content_left_grade">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;距离下一级还差 <span>{$mon2=$valLevel2['grade'] + 201 - $valAuthor2['grade'];}</span> 积分</div>
					<div class="detail_content_left_level_pic">

						<img src="{$webSite}{$valLevel2['levpicture']}">
					</div>
						{/if}
					{/foreach}

				</div>
						
				<!-- 右边区域 -->
				<div class="detail_content_right">
					
				
					<div class="detail_content_right_top2 clearFix">
						<div class="detail_content_right_top2_left"><img src="{$webSite}public/images/time.gif">&nbsp;&nbsp;{$display=myDisplay($resReply[$i]['addtime']);}</div>
						<div class="detail_content_right_top2_right">
							
							<!-- 楼层称号 -->
							<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="">{if $currPage==1}{$f=myFloor($i+1);}{else}{$f=myFloor($num*($currPage - 1)+$i+1);}{/if}</a></div>
							

							
						</div>
					</div>
					
					<!-- 真正的内容 detail_content_right_main -->
					<div class="detail_content_right_main">
						
						<div class="detail_content_right_content">{$resReply[$i]['content']}</div>

					</div>

					<!-- 底部功能 detail_content_right_bottom -->
					<div class="detail_content_right_bottom">
						<ul class="clearFix">
							
							<img class="li_left" src="{$webSite}public/images/reply.gif"/>
							
							<li class="li_left">
								
								<a href="#reply">回复</a>
							</li>
							
						</ul>
					</div>
				</div>
						
			</div>
					
				{/if}
				{/foreach}
			{/for}
			{/if}
		{/if}

			</div>


			<!-- 按钮下 detail_btn 区域 -->
			<div class="detail_btn clearFix">
				<a href="{$webSite}post.php?cid={$currCid}">
					<button class="detail_btn_post">发 帖</button>
				</a>
				<a href="#reply">
					<button class="detail_btn_reply">回 复</button>
				</a>
				<a href="{$webSite}public.php?cid={$currCid}">
					<button class="detail_btn_back">返 回 列 表</button>
				</a>
			</div>

			<!-- 分页显示 detail_page 区域 -->
			
			<div class="detail_page">
				
				<ul class="detail_page_ul clearFix">
					
					<li>
						本页 <span>{$currPage}</span>/<span>{$total=isset($total)?$total:1;}</span>页
					</li>

					<li>

						本页 <span>{$start=isset($offset)?($offset+1):0;}</span>-<span>{$end=($currPage>=$total) ? $count : ($currPage * $num);}</span> 条
					</li>

					<li>
						每页显示 <span>{$num=isset($num)?$num:0;}</span> 条
					</li>

					<li>
						共有 <span>{$count=isset($count)?$count:0;}</span> 条记录
					</li>
					
					<li>
						<a href="{$webSite}detail.php?page={$total}&id={$getId}">尾页</a>
					</li>

					<li>
						<a href="{$webSite}detail.php?page={$next}&id={$getId}">下一页</a>
					</li>

					<li>
						<a href="{$webSite}detail.php?page={$prev}&id={$getId}">上一页</a>
					</li>

					<li>
						<a href="{$webSite}detail.php?page=1&id={$getId}">首页</a>
					</li>	
					
					<form action="{$webSite}detail.php" method="get" enctype=" multipart/form-data" >
					<li class="clearFix">	
						
						<input type="hidden" name="id"  value="{$getId}" />
						<input type="text" name="page">
						<input type="submit" value="GO">
					
					</li>
					</form>


				</ul>
			</div>
		</div>

		<!--  回帖 detail_reply 区域 -->
		<div class="detail_reply clearFix">
			
			<div class="detail_content_left">
				
				<!-- 登录后进行回复 -->
				{foreach $resAuthor as $valAuthor3}
					{if $username}
					{if $valAuthor3['username'] == $username}
				<!-- 用户名 -->
				<div class="detail_content_left_user">
					<div>{$valAuthor3['username']}</div>
				</div>

				<!-- 头像  -->
				<div class="detail_content_left_pic">
					<img src="{$webSite}{$valAuthor3['picture']}">
				</div>

				<!-- 用户身份(权限)  -->
				<div class="detail_content_left_type">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$type3=$valAuthor3['usertype']==1 ? '管理员' : '普通用户' ;}</div>
				
				<!-- 利用用户等级 levname 相等 -->
					{foreach $resLevel as $valLevel3}
						{if $valLevel3['levname'] == $valAuthor3['levname']}
				<!--  用户等级信息 -->
				<div class="detail_content_left_level">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;等级 : <span>{$valAuthor3['levname']}</span></div>

				<!-- 距离下一级还差多少分 -->
				<div class="detail_content_left_grade">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;距离下一级还差 <span>{$mon3=$valLevel3['grade'] + 201 - $valAuthor3['grade'];}</span> 积分</div>
				<div class="detail_content_left_level_pic">

					<img src="{$webSite}{$valLevel3['levpicture']}">
				</div>
						{/if}
					{/foreach}

					{/if}
					{/if}
				{/foreach}

			</div>

			<!-- 回帖框 -->
			<div class="detail_content_right">
				
				<form action="{$webSite}admin/home/reply.php" method="post" enctype="multipart/form-data">
					<div class="detail_answer_right_text">
											
						<!--style给定宽度可以影响编辑器的最终宽度-->
						<script type="text/plain" id="myEditor" name="reply_content" style="width:750px;height:240px;margin:0 auto;"><p style="text-indent:2rem;">生活不止眼前的苟且，还有成千上万条代码要写</p>
						</script>
						<script type="text/javascript">
						    //实例化编辑器
						    var um = UM.getEditor('myEditor');   
						</script>
					</div>

					<div class="detail_answer_right_button">
						<a name="reply"></a>
							
							<input type="hidden" name="id" value="{$getId}">
							<input type="hidden" name="cid" value="{$currCid}">
							<input type="submit" value="发表回复">
			
					</div>
				</form>
				
			</div>

		</div>
	</body>
</html>